<template>
  <div>
    <van-nav-bar title="收货地址" left-text="返回" @click-left="onClickLeft" left-arrow>
      <template #right>
        <van-icon name="search" size="18" />
      </template>
    </van-nav-bar>
    <van-contact-list v-model="chosenContactId" :list="list" default-tag-text="默认" @add="onAdd" @edit="onEdit"
      @select="onSelect" />
  </div>
</template>
<script>
import { Toast } from 'vant'
export default {
  data () {
    return {
      chosenContactId: '1',
      list: [
        {
          id: '1',
          name: '张三',
          tel: '13000000000',
          isDefault: true,
        },
        {
          id: '2',
          name: '李四',
          tel: '1310000000',
        },
      ],
    };
  },
  methods: {
    onAdd () {
      Toast('新增');
    },
    onEdit (contact) {
      Toast('编辑' + contact.id);
    },
    onSelect (contact) {
      Toast('选择' + contact.id);
    },
    onClickLeft () {
      this.$router.go(-1)
    }
  }
}
</script>